#{extends 'master.html' /}
#{set title:"DigitalBand.ru - " + product.title /}
#{set isCatalogActive:'active' /}
<div class="page_part">
    <div>
        <h3 class="categoryTitle">${product.title}</h3>
        <div class="clear"></div>
    </div>
#{if siteUrls != null}
    <div class="breadcrumbs">
        <a href="/" class="home_button">&nbsp;</a>
        #{list items:siteUrls.sitePaths, as:'sitePath'}
            #{if sitePath_isFirst}
                <span class="path_separator">&nbsp;</span>
            #{/if}
            <a href="@{Product.productList(params.getFilter(sitePath.filter))}">${sitePath.title}</a>
            #{if !sitePath_isLast}
                <span class="path_separator">&nbsp;</span>
            #{/if}
        #{/list}
    </div>
#{/if}
</div>
#{if isAdmin}
<form action="@{ProductAdmin.archive(product.id, request.url.toString())}" method="POST" style="display: inline">
    #{if !product.archived}
        <input type="submit" value="В архив!" name="archive"/>
    #{/if}
    #{else}
        <input type="submit" value="Восстановить" name="restore"/>
    #{/else}
    <a href="@{ProductAdmin.getEditForm(product.id, request.url)}">Редактировать</a>
</form>

#{/if}
<div class="page-part">
    <div class="image-container">
        <div class="display-image">
        #{if product.hasPicture}
            <a href="@{Product.gallery(product.id, 1)}">
                <img src="@{Product.productImage(product.id, 1, 300, 270, 'png')}" alt="${product.title}"/>
            </a>
        #{/if}
        #{else}
            <img class="default-image" src="@{Product.defaultImage(300, 270, 'png')}"
                 alt=""/>
        #{/else}

        </div>

    </div>

    <form id="product-details-form" action="@{ShoppingCart.add(product.id)}" method="POST">
        <fieldset>
            <div class="product-question">
                <a href="@{question(filter.getParams())}">Вопрос по этому товару</a>
            </div>
            <div class="clear"></div>
        #{if product.price > 0}
            <div class="display-price">${product.price.formatPrice('ru-RU')}</div>

            <div class="add-to-cart">
                <input type="submit" value="&{'Product.display.addtocart'}"/>
            </div>
        #{/if}
        </fieldset>
        <div class="image-list">
            <div>
            #{if product.hasPicture}
                <ul>
                    #{list items:1..product.imagesCount, as:'i'}
                        <li>
                            <a href="@{Product.gallery(product.id, i)}">
                                <img src="@{Product.productImage(product.id, i, 60, 60, 'png')}"
                                     alt="${product.title}"/>
                            </a>
                        </li>
                    #{/list}
                </ul>

            #{/if}
            </div>
        </div>
    </form>

    <div class="clear"></div>
    <div class="description">
        <p> #{if product.description != null}
        ${product.description.raw()}
        #{/if}
        #{else}
            #{if product.shortDescription != null}
            ${product.shortDescription.raw()}
            #{/if}
        #{/else}
        </p>
    </div>
#{if product.productSources != null}
    <label for="productSourceUrl">Источники:</label><br/>
    #{list items:product.productSources, as:'productSource'}
        <a href="${productSource.url}" id="productSourceUrl">${productSource.url}</a>
    #{/list}
#{/if}
</div>